<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %> 
<script type="text/javascript">
<!--
function bal_myapp_list_rowClick(uid,state,flag){
	var btn = $("#bal_myapp_list_cancel_btn", navTab.getCurrentPanel());
	if(state==1){
		btn.css("display","block");
	}else{
		btn.css("display","none");
	}
	btn.attr("href", "bal_cancelApp.action?uuid="+uid);
	
	var printBtn = $("#bal_myapp_list_print_btn", navTab.getCurrentPanel());
	if(state==2 && flag==0){
		printBtn.css("display","block");
	}else{
		printBtn.css("display","none");
	}
	printBtn.attr("onclick", "bal_myapp_list_print('"+uid+"')");
	//printBtn.click(bal_myapp_list_print(uid))

}

function bal_myapp_list_print(uuid){
	$.post("bal_checkPrint.action", {"uuid":uuid}, function(data){
		 if(data.statusCode=="200"){
			 var options = {max:true,
					 		mask:true,
					 		mixable:false,
					 		minable:false,
					 		resizable:false,
					 		drawable:false
					 		//fresh:true
					 		}; 
			 $.pdialog.open(data.forwardUrl, data.navTabId, data.rel, options);
		 }else{
			 alertMsg.error(data.message);
		 }
		}, "json");
}
//-->
</script>
<c:choose>
	<c:when test="${empty errorMsg }">
<script type="text/javascript">
</script>
<form id="pagerForm" method="post" action="bal_myAppList.action"  onsubmit="return divSearch(this, 'bal_myapp_list');">
	<input type="hidden" name="pageNum" value="${currentPage }" /> 
	<input type="hidden" name="numPerPage" value="${numPerPage}" /> 
</form>
	<div class="panelBar" >
		<ul class="toolBar">
			<li><a  class="look" 
					href="{bal_myapp_list_action}"  
					rel="bal_detail" 
					target="dialog"
					mask="true"
					title="单据明细">
					<span>查看明细</span>
				</a>
			</li>
			<li><a id="bal_myapp_list_cancel_btn" class="delete"
				href="{bal_myapp_list_action}" style="display: none;"
				target="ajaxTodo" title="确定要撤销该申请吗?"><span>撤销</span></a></li>
			<li><a id="bal_myapp_list_print_btn" class="icon-ok"
				href="javascript:void(0);" style="display: none;"><span>打印</span></a></li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="120" rel="bal_myapp_list">
		<thead>
			<tr>
				<th align="center">序号</th>
				<th>结算编号</th>
				<th>结算类型</th>
				<th>申请人</th>
				<th>申请日期</th>
				<th>申请金额</th>
				<th>批复人</th>
				<th>批复日期</th>
				<th>批复金额</th>
				<th>签批人</th>
				<th>签批日期</th>
				<th>单据状态</th>
				<th>打印标识</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${recordList}" var="bal" varStatus="status">
				<tr target="bal_myapp_list_action" rel="bal_<c:choose>
					<c:when test="${bal.balType==6 }">
						showBuMgrDetail
					</c:when>
					<c:when test="${bal.balType==5 }">
						showCustMgrDetail
					</c:when>
					<c:when test="${bal.balType==4 }">
						showCashDetail
					</c:when>
					<c:when test="${bal.balType==3 }">
						showTelfeeDetail
					</c:when>
				</c:choose>.action?billCode=${bal.billCode}" 
				onclick="bal_myapp_list_rowClick('${bal.uuid}','${bal.billState }','${bal.pntFlag}')"
				>
				
				<td>${(status.index+1) + (currentPage-1) * numPerPage}</td>
				<td>${bal.billCode}</td>
				<td>${application.balTypeMap[bal.balType]}</td>
				<td>
					<c:forEach var="sale" items="${saleList}">
	 					<c:if test="${sale.isuId == bal.appUserId }">
							${sale.isuName}
						</c:if>
					</c:forEach>
				</td>
				<td>
					<fmt:parseDate  value="${bal.appDate}" var="appDate" pattern="yyyyMMddHHmmss"/>  
					<fmt:formatDate value="${appDate}" pattern="yyyy-MM-dd HH:mm:ss" /> 
				</td>
				<td>
					<fmt:formatNumber value="${bal.appFee}" type="number" pattern="￥0.00" />
				</td>
				<td>
					<c:forEach var="sale" items="${saleList}">
	 					<c:if test="${sale.isuId == bal.chkUserId }">
							${sale.isuName}
						</c:if>
					</c:forEach>
				</td>
				<td>
					<fmt:parseDate  value="${bal.chkDate}" var="chkDate" pattern="yyyyMMddHHmmss"/>  
					<fmt:formatDate value="${chkDate}" pattern="yyyy-MM-dd HH:mm:ss" /> 
				</td>
				<td>
					<fmt:formatNumber value="${bal.chkFee}" type="number" pattern="￥0.00" />
				</td>
				<td>
					<c:forEach var="sale" items="${saleList}">
	 					<c:if test="${sale.isuId == bal.makUserId }">
							${sale.isuName}
						</c:if>
					</c:forEach>
				</td>
				<td>
					<fmt:parseDate  value="${bal.makDate}" var="makDate" pattern="yyyyMMddHHmmss"/>  
					<fmt:formatDate value="${makDate}" pattern="yyyy-MM-dd HH:mm:ss" /> 
				</td>
				<td>
					<c:choose>
						<c:when test="${bal.billState==1}">新申请</c:when>
						<c:when test="${bal.billState==2}">已批复</c:when>
						<c:when test="${bal.billState==3}">已签批</c:when>
					</c:choose>
				</td>
				<td><c:choose>
						<c:when test="${bal.pntFlag==0}">未打印</c:when>
						<c:when test="${bal.pntFlag==1}">已打印</c:when>
					</c:choose>
				</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>页次&nbsp;${currentPage }&nbsp;/&nbsp;${pageCount }&nbsp;页，</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value}, 'bal_myapp_list')">
				<option ${numPerPage==20?"selected":"" }  value="20">20</option>
				<option ${numPerPage==50?"selected":"" }  value="50">50</option>
			</select>
			<span>条，共${recordCount}条</span>
		</div>
		<div class="pagination" 
			rel="bal_myapp_list" 
			totalCount="${recordCount}"
			numPerPage="${pageSize}" 
			pageNumShown="${pageNumShown}"
			currentPage="${currentPage }">
		</div>
	</div>
</c:when>
	<c:otherwise>
		<div style="padding: 5px;color: red;">页面加载错误！${errorMsg }</div>
	</c:otherwise>
</c:choose>